package com.sxbang.bms.service.impl;

import com.sxbang.bms.base.result.Results;
import com.sxbang.bms.dao.RoleUserDao;
import com.sxbang.bms.model.SysRoleUser;
import com.sxbang.bms.service.RoleUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class RoleUserServiceImpl implements RoleUserService {
    @Autowired
    private RoleUserDao roleUserDao;

    @Override
    public int updateSysRoleUser(SysRoleUser sysRoleUser) {
        return roleUserDao.updateSysRoleUser(sysRoleUser);
    }

    @Override
    public Results getSysRoleUserByUserId(Integer userId) {
        SysRoleUser sysRoleUser = roleUserDao.getSysRoleUserByUserId(userId);
        if(sysRoleUser != null){
            return Results.success(sysRoleUser);
        }else{
            return Results.success();
        }
    }


    @Override
    public Results save(SysRoleUser sysRoleUser) {
        roleUserDao.save(sysRoleUser);
        return  Results.success();
    }
}
